<main class="lyear-layout-content">

  <div class="container-fluid p-t-15">
    <div class="row">
      <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <div class="callout callout-success card card-body clearfix" style="flex-direction:row;">
          <h4>帖子数据统计</h4>
        </div>
      </div>
    </div>

    <div class="row">
      <div class="col-lg-12">
        <div class="card">
          <div class="card-header">
            <h4>线形图</h4>
          </div>
          <div class="card-body">
            <canvas id="chart-line-4" width="1545" height="580"></canvas>
          </div>
        </div>
      </div>
    </div>

  </div>

</main>

<!-- <script type="text/javascript" src="/static/admin/js/Chart.min.js"></script> -->
<script type="text/javascript">
  $.ajax({
    url: `{:url('admin/analysis/post')}`,
    type: 'post',
    data: {
      action: 'line'
    },
    dataType: 'json',
    success: function (success) {
      var name = success.data.name
      var Accept = success.data.Accept
      var NoAccept = success.data.NoAccept

      // type: 'line' 线性图
      new Chart($("#chart-line-4"), {
        type: 'line',
        data: {
          labels: name,
          datasets: [{
              label: "采纳",
              fill: false,
              borderWidth: 4,
              pointRadius: 4,
              borderColor: "#36a2eb",
              backgroundColor: "#36a2eb",
              pointBackgroundColor: "#36a2eb",
              pointBorderColor: "#36a2eb",
              pointHoverBackgroundColor: "#fff",
              pointHoverBorderColor: "#36a2eb",
              data: Accept, //X轴对应的值
            },
            {
              label: "未采纳",
              fill: false,
              borderWidth: 4,
              pointRadius: 4,
              borderColor: "#ff6384",
              backgroundColor: "#ff6384",
              pointBackgroundColor: "#ff6384",
              pointBorderColor: "#ff6384",
              pointHoverBackgroundColor: "#fff",
              pointHoverBorderColor: "#ff6384",
              data: NoAccept //X轴对应的值
            }
          ]
        },
        options: {
          // responsive: false,
        }
      });
    }
  })
</script>